#include <iostream>
#include <string>
// 包含SpireMS SDK头文件
#include <sms_core.h>
#include "sv2_mot.h"


using namespace std;


// const char* about = "Create an ArUco marker image";
// const char* keys  =
//     "{@job_name      |<none> | The node's job name }"
//     "{@full_det_name |<none> | Full image detector's job_name }"
//     "{@roi_det_name  |<none> | ROI detector's job_name }"
//     "{@param_file    |<none> | AutoFocusDetCppNode's parameters }";


int main(int argc, char *argv[])
{
    // cv::CommandLineParser parser(argc, argv, keys);
    // parser.about(about);
    
    nlohmann::json std_params, extra_params;
    if (!sms::get_std_and_extra_args(argc, argv, std_params, extra_params))
        return 0;

    // if(argc < 5) {
    //     parser.printMessage();
    //     return 0;
    // }

    // std::cout << "job_name: " << parser.get<std::string>(0) << std::endl;
    // std::cout << "full_det_name: " << parser.get<std::string>(1) << std::endl;
    // std::cout << "roi_det_name: " << parser.get<std::string>(2) << std::endl;
    // std::cout << "config: " << parser.get<std::string>(3) << std::endl;

    // std::string job_name = parser.get<std::string>(0);
    // std::string full_det_name = parser.get<std::string>(1);
    // std::string roi_det_name = parser.get<std::string>(2);
    // std::string config = parser.get<std::string>(3);

    // sv2::MOTCppNode node(job_name, full_det_name, roi_det_name, config);
    // sv2::MOTCppNode node(std_params["job_name"], std_params["full_det_name"], std_params["roi_det_name"], std_params["config"], std_params["ip"], std_params["port"], extra_params);
    std::cout << "--config: "<< std_params["config"] << std::endl;
    std::cout << "--job-name: "<< std_params["job_name"] << std::endl;
    // extra_params["logger_to_screen"] = false;
    sv2::MOTCppNode node(std_params["job_name"], std_params["config"], std_params["ip"], std_params["port"], extra_params);
    node.start();
    node.join();
    return 0;
}
